﻿using Microsoft.EntityFrameworkCore;
using Ordering.Orders;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.DistributedEvents;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace Ordering.EntityFrameworkCore
{
    public static class OrderingDbContextModelCreatingExtensions
    {
        public static void ConfigureOrdering(
            this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Entity<Order>(b =>
            {
                b.ToTable(OrderingDbProperties.DbTablePrefix + "Orders", OrderingDbProperties.DbSchema);
                b.ConfigureByConvention();
            });

            builder.ConfigureEventOutbox();
            builder.ConfigureEventInbox();
        }
    }
}
